package org

class DateUtils {
    static  getDateOfWeek(Date date) {
        def c= Calendar.instance
        if(date) {
            c.time = date
        }
        switch(c.get(Calendar.DAY_OF_WEEK)) {
            case 1:
                return '星期天'
            case 2:
                return '星期一'
            case 3:
                return '星期二'
            case 4:
                return '星期三'
            case 5:
                return '星期四'
            case 6:
                return '星期五'
            case 7:
                return '星期六'
        }
    }


    static Date getFormDate(Date clearDate,String remark){
        Calendar cal= Calendar.getInstance();
        cal.setTime(clearDate);

        if(remark=='start'){
            cal.add(Calendar.DATE,  -1);
            cal.add(Calendar.HOUR_OF_DAY, 6);
        }else{
            cal.add(Calendar.HOUR_OF_DAY, 6);
        }
        return cal.getTime();
    }

}
